<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view v-if="isRouterAlive" />
    </div>
  </a-config-provider>
</template>

<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import { AppDeviceEnquire } from '@/utils/mixin'

export default {
  mixins: [AppDeviceEnquire],
  provide() {
    return {
      reload: this.reload
    }
  },
  data() {
    return {
      locale: zhCN,
      isRouterAlive: true
    }
  },
  created() {
    //在页面加载时读取sessionStorage里的状态信息
    if (sessionStorage.getItem('store')) {
      this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))))
    }
    //在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener('beforeunload', () => {
      if (this.$route.name !== 'login') {
        sessionStorage.setItem('store', JSON.stringify(this.$store.state))
      } else {
        window.sessionStorage.clear()
      }
    })
  },
  mounted() {},
  methods: {
    reload() {
      this.isRouterAlive = false
      this.$nextTick(function() {
        this.isRouterAlive = true
      })
    }
  }
}
</script>
<style lang="scss">
@import "./styles/mypublic.scss";
.ant-tabs-tab {
  font-size: 16px !important;
}
#moreButton {
  position: absolute;
  top: 34px;
  right: 20px;
}
#app {
  height: 100%;
}
/*修改滚动条样式*/
::-webkit-scrollbar {
  width: 8px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(239, 239, 239, 0);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}
::-webkit-scrollbar-corner {
  background: #179a16;
}
.ant-menu {
  font-size: 14px !important;
}
.ant-menu-item-selected > a > i > svg > path {
  fill: #fff;
}
.ant-menu-item:hover > a > i > svg > path {
  fill: #fff;
}
.layout.ant-layout .sidemenu .ant-header-fixedHeader.ant-header-side-opened {
  width: calc(100% - 180px) !important;
}
.user_management_table {
  // border:1px solid #e8e8e8;
  .ant-alert.ant-alert-info {
    margin-top: 16px;
  }
  .ant-table-wrapper {
    .ant-spin-nested-loading {
      .ant-spin-container {
        .ant-table {
          border: 1px solid #e8e8e8 !important;
          border-radius: 4px;
          .ant-table-content {
            .ant-table-placeholder {
              border-bottom: none !important;
            }
          }
        }
      }
    }
  }
  .ant-table-thead {
    tr {
      th {
        border-bottom: none !important;
      }
    }
  }
  .ant-table-tbody {
    tr {
      td {
        border-bottom: none !important;
      }
    }
  }
  tr:nth-child(2n) {
    background: #fafafa;
  }
}
// .ant-table-pagination.ant-pagination{
//   width:100%;
//   display: flex;
// }
.ant-pagination-total-text{
  margin-right: 20px !important;
}

/* .ant-modal{
  top:100px  !important;
} */
</style>
